package com.springmvc.web.pub.controller;

import java.io.File;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.springmvc.utils.DownloadUtils;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author WangRuChao
 * @since 2017-11-24
 */
@Controller
@RequestMapping("/download")
public class DownloadController {

	@RequestMapping
	public void down(Model model, HttpServletRequest request, HttpServletResponse response) throws Exception {
		try {
			File file = new File("C:/Users/Administrator/Desktop/PanDownload.exe");
			DownloadUtils.download(response, file, "PanDownload.exe", "utf-8");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
	}

}
